<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>{$_title}</h2>
    </div>
    <notempty name="contract" >
    	<form action="{:U('Contract/editContract')}" method="post" class="form-horizontal">
    		<input type="hidden" name="id" value="{$contract.id}" />
    <else />
	    <form action="{:U('Contract/addContract')}" method="post" class="form-horizontal">
    </notempty>
        <div class="form-item">
            <label class="item-label">合同代码<span class="check-tips">（合同代码会作为合同的唯一标识，只能包括字母、数字和下划下，创建之后不要中修改）</span></label>
            <div class="controls">
            	<notempty name="contract">
            		<input type="text" class="text input-large"   readonly name="code" value="{$contract.code|default=''}">
            	<else/>
	                <input type="text" class="text input-large" name="code" value="{$contract.code|default=''}">
            	</notempty>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">合同名称<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="{$contract.name|default=''}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">合同标题<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="title" value="{$contract.title|default=''}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">合同类型<span class="check-tips"></span></label>
            <div class="controls">
            	<select name="type" class="input-large">
            		<foreach name="Think.config.FUND_CONTRACT" key="key" item="val">
            			<if condition="$key eq $contract['type']">
	            			<option value="{$key}" selected>{$val}</option>
            			<else />
	            			<option value="{$key}">{$val}</option>
            			</if>
            		</foreach>
            	</select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">合同内容<span class="check-tips"></span></label>
            <div class="controls">
                <textarea rows="5" class="input-large kind-editor" name="content">{$contract.content|default=''}</textarea>
            </div>
        </div>
        
        <notempty name="contract" >
	        <div class="form-item">
	            <label class="item-label">更新说明<span class="check-tips">（详情说明更新的内容）</span></label>
	            <div class="controls">
	                <textarea name="update_note" lass="text input-large" style="min-width:900px;min-height:300px;padding:5px;"></textarea>
	            </div>
	        </div>
    	</notempty>
        
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
	<link rel="stylesheet" href="__PUBLIC__/static/kindeditor/default/default.css" />
	<script charset="utf-8" src="__PUBLIC__/static/kindeditor/kindeditor-min.js"></script>
	<script charset="utf-8" src="__PUBLIC__/static/kindeditor/zh_CN.js"></script>
    <script type="text/javascript">
		KindEditor.ready(function(K) {
			window.editor = K.create('textarea[class="kind-editor"]', {
				//allowFileManager : false
				allowFileManager : true,
				uploadJson:"{:U('File/kinderUpload')}",
				minWidth:900,
				minHeight:300,
				afterBlur: function(){this.sync();},
			});
		});
	
        //导航高亮
        highlight_subnav('{:U('Contract/contractList')}');
    </script>
</block>
